/**
 * 处理字符串是否等于空
 * @returns {boolean}
 */
String.prototype.isEmpty = function () {
    return (this == null || this.length == 0);
}
/**
 * 处理字符串是否不等于空
 * @returns {boolean}
 */
String.prototype.isNotEmpty = function () {
    return (this != null && this.length > 0);
}
/**
 *  替换所有
 * @param repStr 需要替换的值
 * @param newRepStr 替换的新值
 * @returns {string}
 */
String.prototype.replaceAll = function (repStr, newRepStr) {
    return this.toString().replace(new RegExp(repStr, "gm"), newRepStr);
}
/**
 * list分组
 */
Array.prototype.groupBy = function (name) {
    return this.reduce((ac, cur, index) => {
        const target = ac.find(v => cur[name] === v[name])
        if (target) {
            target.children.push(cur)
        } else {
            ac.push({...cur, children: []})
        }
        return ac
    }, []);
}
